/** @jsxImportSource @emotion/react */
import * as React from "react";
import {
   CCell, Cell, Table, TableBody, TableRow, Text,
} from "customize-easy-ui-component";
import { DirectLink } from "../../../routing/Link";
import {结论报告盖章} from "../viewRes";
import {useThreeColumnView} from "../../hook/useThreeColumnSubr";
import {config设备概况} from "./orcBase";

//整个结论报告页
export const 检验结论报告= ({ orc, rep,theme } : { orc: any, rep: any,theme:any}
) => {
  const [firstNode,secNode]=useThreeColumnView({orc, config:config设备概况,slash:true,split:[10],
    embedCol: [undefined, <CCell rowSpan={3}>性能参数</CCell>]
  });
  return <>
    <Text id={'Conclusion'} variant="h2" css={{textAlign:'center',
      "@media print": {
        pageBreakBefore: 'always',
      },
    }}>移动式压力容器年度检验结论报告</Text>
    <Text css={{display: 'flex',flexDirection: 'row-reverse',marginRight: '2rem'
    }}>报告编号：{rep.isp?.no}</Text>
    <Table fixed={ ["19.9%","19%","18%","12.1%","16%","%"] } css={ {borderCollapse: 'collapse' } }  tight  miniw={800}>
      <TableBody>
        <DirectLink  href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Survey#Survey`}>
          {firstNode}
        </DirectLink>
      </TableBody>
    </Table>
    <Table fixed={  ["4%","15.9%","17%","20%","12.1%","14%","%"]  } css={ {borderCollapse: 'collapse' } }  tight  miniw={800}>
      <TableBody>
        <DirectLink  href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Survey#Survey`}>
          {secNode}
        </DirectLink>
      </TableBody>
    </Table>

    <Table fixed={ ["7%","15%","34%","16%","%"]  } css={ {borderCollapse: 'collapse' } }  tight  miniw={800}>
      <TableBody>
        <DirectLink  href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Survey#Survey`}>
          <TableRow >
            <CCell >检验依据</CCell>
            <CCell colSpan={4}>
              《移动式压力容器安全技术监察规程》（TSG R0005）及第1、2、3号修改单<br/>
              《压力容器定期检验规则》（TSG R7001）
            </CCell>
          </TableRow>
        </DirectLink>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Conclusion#Conclusion`}>
          <TableRow>
            <CCell>问题及其处理</CCell>
            <Cell split={true} colSpan={4}><div css={{minHeight: '3rem', whiteSpace: 'pre-wrap'}}>
              {orc.问题及处 || '／'}
            </div></Cell>
          </TableRow>
        </DirectLink>
      </TableBody>
    </Table>
    {结论报告盖章({theme, orc, rep})}
  </>;
};
